module.exports = async function (boardId,title,start,end) {
    const calendarTemplate = await api.runOnBackend(() => {
        return (api.getNoteWithLabel("calendarTemplates").getChildNotes()
      ).find((m) => m.hasAttribute("label", "calendarNote"));
        });
    // create the new note
    const cardId = await api.runOnBackend((boardId,title, start, end,calendarTemplate) => { 
        const card = api.createNewNote({
            parentNoteId: boardId,
            title: title,
            content: "",
            type :"text",
         });
        card.note.addLabel("startDate", start);
        card.note.addLabel("endDate", end);
        card.note.addRelation("child:template", calendarTemplate.noteId);
        card.note.save();
        return card.note.noteId;
    }, [boardId.noteId,title,start,end,calendarTemplate]);
    await api.waitUntilSynced();
}